.POSIX:
PREFIX=		/usr/local
MANDIR=		man

el_CFLAGS=	${CFLAGS} `pkg-config --cflags libedit`
el_LDFLAGS=	${LDFLAGS} `pkg-config --libs libedit`

default: el
all: default README
el: el.c Makefile
	${CC} ${$@_CFLAGS} ${$@_LDFLAGS} -o $@ el.c
install: el
	install -m 755 el ${DESTDIR}${PREFIX}/bin/
	install -m 444 el.1 ${DESTDIR}${PREFIX}/${MANDIR}/man1/
install-local: el
	install -m 755 el ${HOME}/bin/
README: el.1 Makefile
	mandoc -Ios= -Tutf8 el.1 |\
	    awk '{gsub(/.\b/,"");a=b;b=c;c=$$0}FNR>4{print a}' > $@
clean:
	rm -f el
clean-all: clean
	rm -f README
